<template>
	<view class="ring">
		<!-- 搜索关键字 -->
		<view class="padding-horizontal-main padding-top-main padding-bottom-sm pr">
			<view class="top-search-input">
				<component-search :propDefaultValue="post_data.wd || ''" @onsearch="search_input_confirm_event"
					:propIsOnEvent="true" @oninput="search_input_value_event" :propIsOnInputEvent="true"
					@onfocus="search_input_focus_event" :propIsOnFocusEvent="true" @onblur="search_input_blur_event"
					:propIsOnBlurEvent="true" :propIsRequired="false" propPlaceholder="关键字,名称,款号搜索"></component-search>
			</view>
			<view class="pa top-search-right">
				<view v-if="top_search_right_type_status" class="pr cp" @tap="search_submit_confirm_event">
					<uni-icons type="search" size="60rpx" color="#bbb"></uni-icons>
				</view>
				<view v-if="!top_search_right_type_status" class="pr cp" data-value="/pages/cart/cart" @tap="url_event">
					<uni-icons type="cart" size="60rpx" color="#bbb"></uni-icons>
					<view v-if="top_right_cart_total != 0" class="badge-icon pa">
						<component-badge :propNumber="top_right_cart_total"></component-badge>
					</view>
				</view>
			</view>
		</view>
		<view class="ring_bg" v-if="brandType == '甄选'">
			<image src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/31/5f130aaaf9904ec39edd88621dbc7919.jpg"
				mode="widthFix"></image>
		</view>
		<!-- 排序 -->
		<view class="nav-sort bg-white oh pr">
			<view class="nav-sort-content">
				<block v-for="(item, index) in search_nav_sort_list" :key="index">
					<view class="item tc fl cp" :data-index="index" @tap="nav_sort_event">
						<text class="cr-base va-m">{{item.name}}</text>
						<block v-if="item.icon=='default'">
							<image v-if="(item.icon || null) != null" class="icon va-m"
								src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/1eadfdbfe8bb4241a452fa97f4772af7.png"
								mode="aspectFill"></image>
						</block>
						<block v-else>
							<image v-if="(item.icon || null) != null" class="icon va-m"
								src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/009e7b49ce824d90975bc06ead1ad080.png"
								mode="aspectFill"></image>
						</block>

					</view>
				</block>
			</view>
			<view class="screening" @tap="popup_form_event_show">
				<view class="screening-name pa">筛选</view>
				<image class="screening-submit pa cp"
					src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/ddc932c985a549509f57731ca686c08d.png"
					mode="aspectFill"></image>
			</view>
		</view>
		<!-- 品类筛选 -->
		<view class="category_screening">
			<view class="category_screening_item" v-for="(item,index) in category_screening_list" :key="index"
				:class="{'activeCategory':category_screening_index == index}" :data-index="index" :data-id="item.id"
				@click="category_envent">
				<image :src="item.images_url" mode="widthFix"></image>
				<view class="">{{item.name}}</view>
			</view>
		</view>
		<!-- 筛选条件 popup -->
		<component-popup :propShow="is_show_popup_form" propPosition="left" @onclose="popup_form_event_close">
			<form @submit="form_submit_event" class="oh popup_content">
				<view class="search-map bg-base ">
					<!-- 品类 -->
					<view
						v-if="(search_map_list.category_list || null) != null && search_map_list.category_list.length > 0"
						class="map-item padding-horizontal-main padding-top-main border-radius-main bg-white spacing-mt popup_color">
						<view class="map-nav pr br-b">
							<text>品类</text>
						</view>
						<view class="map-content map-text-item map-category-container oh margin-top-lg"
							:style="'height: auto;'">
							<block v-for="(item, index) in search_map_list.category_list" :key="index">
								<view
									:class="'item fl cp popup_item' + (item.active == 1 ? 'cr-main popup_item_active' : '')"
									@tap="map_item_event" :data-index="index" data-field="category_list">{{item.name}}
								</view>
							</block>
						</view>
					</view>
					<!-- 款式分类 -->
					<view
						v-if="(search_map_list.storeCategory_list || null) != null && search_map_list.storeCategory_list.length > 0"
						class="map-item padding-horizontal-main padding-top-main border-radius-main bg-white spacing-mt popup_color">
						<view class="map-nav pr br-b">
							<text>款式</text>
						</view>
						<view class="map-content map-text-item map-category-container oh margin-top-lg"
							:style="'height: auto;'">
							<block v-for="(item, index) in search_map_list.storeCategory_list" :key="index">
								<view
									:class="'item fl cp popup_item' + (item.active == 1 ? 'cr-main popup_item_active' : '')"
									@tap="map_item_event" :data-index="index" data-field="storeCategory_list">
									{{item.name}}
								</view>
							</block>
						</view>
					</view>
					<!-- 金成色 -->
					<view
						v-if="(search_map_list.gold_colour_list || null) != null && search_map_list.gold_colour_list.length > 0"
						class="map-item padding-horizontal-main padding-top-main border-radius-main bg-white spacing-mt popup_color">
						<view class="map-nav pr br-b">
							<text>金成色</text>
						</view>
						<view class="map-content map-text-item map-category-container oh margin-top-lg"
							:style="'height: auto;'">
							<block v-for="(item, index) in search_map_list.gold_colour_list" :key="index">
								<view
									:class="'item fl cp popup_item' + (item.active == 1 ? 'cr-main popup_item_active' : '')"
									@tap="map_item_event" :data-index="index" data-field="gold_colour_list">
									{{item.dictLabel}}
								</view>
							</block>
						</view>
					</view>
					<!-- 品牌 -->
					<view
						v-if="((search_map_list.brand_list || null) != null && search_map_list.brand_list.length > 0) || ((search_map_info.brand || null) != null)"
						class="map-item padding-horizontal-main padding-top-main border-radius-main bg-white spacing-mt">
						<view class="map-nav br-b pr">
							<text>品牌</text>
						</view>
						<view v-if="(search_map_info.brand || null) != null && (params.brand || null) != null"
							class="map-content brand-info oh margin-top-lg">
							<image v-if="(search_map_info.brand.logo || null) != null" :src="search_map_info.brand.logo"
								mode="aspectFit" class="fl"></image>
							<view v-else class="info-logo-empty tc fl">{{search_map_info.brand.name}}</view>
							<view class="info-right fr">
								<view v-if="(search_map_info.brand.logo || null) != null" class="info-name">
									{{search_map_info.brand.name}}
								</view>
								<view v-if="(search_map_info.brand.describe || null) != null"
									class="info-desc multi-text cr-grey">{{search_map_info.brand.describe}}</view>
							</view>
						</view>
						<view v-else class="map-content map-images-text-item map-brand-container oh margin-top-lg"
							:style="'height: auto;'">
							<block v-for="(item, index) in search_map_list.brand_list" :key="index">
								<view
									:class="'item fl cp popup_item ' + (item.active == 1 ? 'cr-main popup_item_active' : '')"
									@tap="map_item_event" :data-index="index" data-field="brand_list">
									<image v-if="(item.logo || null) != null" :src="item.logo" mode="aspectFit"></image>
									<text v-else>{{item.name}}</text>
								</view>
							</block>
						</view>
					</view>
					<!-- 金重 -->
					<view
						v-if="(search_map_list.screening_goldWeight_list || null) != null && search_map_list.screening_goldWeight_list.length > 0"
						class="map-item padding-horizontal-main padding-top-main border-radius-main bg-white spacing-mt">
						<view class="map-nav pr br-b">
							<text>金重</text>
						</view>
						<view class="map-content map-text-item map-category-container oh margin-top-lg"
							:style="'height: auto;'">
							<block v-for="(item, index) in search_map_list.screening_goldWeight_list" :key="index">
								<view
									:class="'item fl cp popup_item ' + (item.active == 1 ? 'cr-main popup_item_active' : '')"
									@tap="map_item_event" :data-index="index" data-field="screening_goldWeight_list">
									{{item.name}}
								</view>
							</block>
						</view>
					</view>
					<view class="search-submit padding-main pa">
						<button form-type="submit" class="bg-main cr-white text-size wh-auto round submit_btn"
							:disabled="popup_form_loading_status" hover-class="none">确认</button>
					</view>
				</view>
			</form>
		</component-popup>
		<!-- 列表 -->
		<view class="ring_img" v-show="state">
			<image src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/51188db041cc42d889872e5c800abffb.png"
				mode="widthFix"></image>
		</view>
		<scroll-view scroll-y="true" style="height: 100vh;" @scrolltolower="scroll_lower" v-if="list_state">
			<view class="ring_list">
				<view class="ring_item" v-for="item in data_list" :key="item.goods_id" @click="onDetail(item.goods_id)">
					<view class="ring_images">
						<image :src="item.images" mode="widthFix"></image>
					</view>
					<view class="ring_name">{{item.title}}</view>
					<view class="" v-if="item.pricingModel == '1'">
						<view class="ring_wages" v-if="vipCertification==='1'">
							批发
							<view class="ring_wages_item">基础工费: <text>{{item.wholesaleWage}}</text> </view>
							<view class="ring_wages_item">附加费: <text>{{item.wholesaleSurcharge}}</text> </view>
							<view class="ring_wages_item">件工费: <text>{{item.wholesaleOtherExpenses}}</text> </view>
						</view>
						<view class="ring_wages" v-else>
							<!-- 销售 -->
							<view class="ring_wages_item">基础工费: <text>{{item.wage}}</text> </view>
							<view class="ring_wages_item">附加费: <text>{{item.surcharge}}</text> </view>
							<view class="ring_wages_item">件工费: <text>{{item.otherExpenses}}</text> </view>
						</view>
					</view>
					<view class="ring_weight">
						<view class="">库存：{{item.inventory}}</view>
						<view class="">{{item.goldWeight}}g</view>
					</view>
					<view class="ring_price">￥{{item.price}}</view>
				</view>
			</view>
			<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
		</scroll-view>
	</view>
</template>

<script>
	const app = getApp();
	import componentPopup from "../../components/popup/popup.vue";
	import componentSearch from "../../components/search/search.vue";
	import componentBottomLine from "../../components/bottom-line/bottom-line.vue";

	export default {
		data() {
			return {
				state: false,
				list_state: true,
				ringList: [],
				cate_id: "",
				data_list_loding_status: 1,
				data_bottom_line_status: false,
				data_list: [],
				data_total: 0,
				data_page_total: 0,
				data_page: 1,
				page: 1,
				hasMoreData: true,
				params: null,
				post_data: {},
				is_show_popup_form: false,
				popup_form_loading_status: false,
				top_search_right_type_status: false,
				// 购物车
				top_right_cart_total: 0,
				// 自定义分享信息
				share_info: {},
				// 搜素条件
				search_map_list: {
					brand_list: [],
					category_list: [],
					screening_goldWeight_list: [],
					storeCategory_list: [],
					screening_price_list: [],
					goods_params_list: [],
					goods_spec_list: [],
					gold_colour_list: [],
				},
				model_number:'',
				search_map_info: [],
				map_fields_list: {
					brand_list: {
						height: "100rpx",
						default: "100rpx",
						form_key: "brand_ids"
					},
					gold_colour_list: {
						height: "100rpx",
						default: "100rpx",
						form_key: "colours"
					},
					category_list: {
						height: "82rpx",
						default: "82rpx",
						form_key: "category_ids"
					},
					screening_goldWeight_list: {
						height: "82rpx",
						default: "82rpx",
						form_key: "gold_ids"
					},
					storeCategory_list: {
						height: "82rpx",
						default: "82rpx",
						form_key: "cate_ids"
					},
					screening_price_list: {
						height: "82rpx",
						default: "82rpx",
						form_key: "screening_price_values"
					},
					goods_params_list: {
						height: "82rpx",
						default: "82rpx",
						form_key: "goods_params_values"
					},
					goods_spec_list: {
						height: "82rpx",
						default: "82rpx",
						form_key: "goods_spec_values"
					}
				},
				// 排序导航
				search_nav_sort_index: 0,
				search_nav_sort_list: [{
						name: "综合",
						field: "default",
						sort: "asc",
						"icon": null
					},
					{
						name: "销量",
						field: "sales",
						sort: "asc",
						"icon": "default"
					},
					// {
					// 	name: "热度",
					// 	field: "accessCount",
					// 	sort: "asc",
					// 	"icon": "default"
					// },
					{
						name: "价格",
						field: "price",
						sort: "asc",
						"icon": "default"
					},
					{
						name: "最新",
						field: "u.create_time",
						sort: "asc",
						"icon": "default"
					}
				],
				entryTime: 0,
				category_screening_list: [],
				category_screening_index: -1,
				// category_id: ''
				cate_id: '',
				brandType: ''
			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.data_page = 1;
			this.getgoodsRing();
		},

		methods: {
			init(e) {
				var user = app.globalData.get_user_info(this, "init", "");
				if (user != false) {
					// 用户未绑定用户则转到登录页面
					if (app.globalData.user_is_need_login(user)) {
						uni.navigateTo({
							url: "/pages/login/login?event_callback=init"
						})

					} else {
						this.get_data();
						this.getgoodsRing();
					}
				}
			},
			// 初始换数据
			get_data() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				var post_data = this.request_map_handle();
				uni.request({
					url: app.globalData.get_request_url("isearch"),
					method: "POST",
					data: post_data,
					success: (res) => {
						uni.hideLoading();
						uni.stopPullDownRefresh();
						if (res.data.code == 200) {
							var data = res.data.data;
							this.search_map_list.brand_list = data.brand_list;
							this.search_map_list.gold_colour_list = data.gold_colour_list;
							this.search_map_list.category_list = data.category_list;
							this.search_map_list.screening_goldWeight_list = data.screening_goldWeight_list;
							this.search_map_list.storeCategory_list = data.storeCategory_list;
							this.category_screening_list = data.storeCategory_list.filter(item =>
								!item.name.includes('版') && !item.name.includes('托')
							);
						} else {
							if (app.globalData.is_login_check(res.data, this, 'get_data')) {
								uni.showToast({
									icon: 'none',
									title: res.data.msg,
									duration: 3000
								});
							}
						}
						uni.hideLoading()
					}
				})
			},
			// 获取数据
			getgoodsRing() {
				this.state = false;
				this.list_state = true;
				// 分页是否还有数据
				if (this.data_bottom_line_status == true) {
					uni.stopPullDownRefresh();
					return false;
				};
				// 获取数据
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				var post_data = this.request_map_handle();
				var url = app.globalData.get_request_url("dsearch");
				uni.request({
					url: url,
					method: "POST",
					data: post_data,
					success: (res) => {
						uni.hideLoading();
						uni.stopPullDownRefresh();
						if (res.data.code == 200) {
							var data = res.data.data;
							if (data.data.length === 0) {
								this.state = true;
								this.list_state = false;
								this.data_bottom_line_status = true;
							} else {
								if (this.data_page <= 1) {
									var temp_data_list = data.data;
								} else {
									var temp_data_list = this.data_list || [];
									var temp_data = data.data;
									for (var i in temp_data) {
										temp_data_list.push(temp_data[i]);
									}
								}
								this.data_list = temp_data_list;
								this.data_page = this.data_page + 1;
								this.page_total = data.page_total;
								this.data_total = data.total;
								if (this.data_page > 1 && this.data_page > this.page_total) {
									this.data_bottom_line_status = true;
								}
							}
						} else {
							if (app.globalData.is_login_check(res.data, this, 'get_data')) {
								uni.showToast({
									icon: 'none',
									title: res.data.msg,
									duration: 3000
								});
							}
						}
						uni.hideLoading()
					}
				})
			},
			// 搜索
			search_event() {
				this.data_list = [];
				this.data_page = 1;
				this.getgoodsRing();
			},
			// 滚动加载
			scroll_lower() {
				this.getgoodsRing();
			},
			// 跳转详情
			onDetail(id) {
				uni.navigateTo({
					url: "/pages/goods_detail/goods_detail?id=" + id
				})
			},
			// 搜索条件处理
			request_map_handle() {
				let post_data = this.post_data;
				var params = this.params;
				post_data['page'] = this.data_page;
				post_data['mall_type'] = params['mall_type'] || 0; //商城类型

				// if (this.category_screening_index !== -1) {
				// 	post_data['category_id'] = this.category_id;
				// } else{
				// 	post_data['category_id'] = params['category_id'] || 0; //品类
				// }

				if (this.category_screening_index !== -1) {
					post_data['cate_id'] = this.cate_id;
				} else {
					post_data['cate_id'] = params['cate_id'] || 0; //分类
				}

				// 指定品类、分类、品牌
				post_data['category_id'] = params['category_id'] || 0; //品类
				// post_data['cate_id'] = params['cate_id'] || 0; //分类
				post_data['brand'] = params['brand'] || 0; //品牌系列
				if (this.category_screening_index == -1) {
					// 搜索条件
					var temp_field = this.map_fields_list;
					var temp_list = this.search_map_list;
					for (var i in temp_field) {
						if (temp_list[i] != null != null && temp_list[i].length > 0) {
							var temp = {};
							var index = 0;
							for (var k in temp_list[i]) {
								if ((temp_list[i][k]['active'] || 0) == 1) {
									switch (i) {
										// 价格
										case 'screening_price_list':
											temp[index] = temp_list[i][k]['min_price'] + '-' + temp_list[i][k][
												'max_price'
											];
											break;
											// 属性、规格
										case 'goods_params_list':
										case 'goods_spec_list':
											temp[index] = temp_list[i][k]['value'];
											break;
											// 默认取值id
										default:
											temp[index] = temp_list[i][k]['id'];
									}
									index++;
								}
							}
							post_data[temp_field[i]['form_key']] = JSON.stringify(temp)

						}
					}
				}
				// 排序
				var temp_index = this.search_nav_sort_index;
				var temp_search_nav_sort = this.search_nav_sort_list;
				post_data['order_by_type'] = temp_search_nav_sort[temp_index]['sort'] == 'desc' ? 'asc' : 'desc';
				post_data['order_by_field'] = temp_search_nav_sort[temp_index]['field'];
				return post_data;
			},

			// url事件
			url_event(e) {
				uni.switchTab({
					url: "/pages/cart/cart"
				})
			},
			// 搜索条件
			form_submit_event(e) {
				this.post_data = e.detail.value;
				this.resetSearch();
				this.popup_form_event_close();
				this.getgoodsRing(1);
			},
			// 筛选条件开启
			popup_form_event_show(e) {
				this.is_show_popup_form = true
			},
			// 筛选条件关闭
			popup_form_event_close(e) {
				this.is_show_popup_form = false
			},
			// 搜索输入确认事件
			search_input_confirm_event(value) {
				for (var i in this.search_map_list) {
					if ((this.search_map_list[i] || null) != null && this.search_map_list[i].length > 0) {
						for (var k in this.search_map_list[i]) {
							if (this.search_map_list[i][k]['active'] >= 0) {
								this.$set(this.search_map_list[i][k], 'active', null)
							}
							// if (this.search_map_list[i][k]['name'].indexOf(value) >= 0) {
							// 	this.$set(this.search_map_list[i][k], 'active', k)
							// }
						}
					}
				}
				var temp_post = this.post_data;
				this.post_data.wd = value;
				this.resetSearch()
				this.getgoodsRing(1);
			},
			// 搜索输入框输入获取焦点事件
			search_input_focus_event() {
				this.top_search_right_type_status = true
			},
			// 搜索输入框输入失去焦点事件
			search_input_blur_event(value) {
				if (value == '') {
					this.top_search_right_type_status = false
				}
			},
			// 搜索确认事件
			search_submit_confirm_event() {
				this.resetSearch();
				this.getgoodsRing(1);
			},
			// 搜索输入事件
			search_input_value_event(value) {
				this.post_data.wd = value;
			},
			// 重置搜索状态
			resetSearch() {
				this.data_page = 1;
				this.data_list = [];
				this.top_search_right_type_status = false;
			},

			// 排序事件
			nav_sort_event(e) {
				var index = e.currentTarget.dataset.index || 0;
				var temp_search_nav_sort = this.search_nav_sort_list;
				var temp_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
				for (var i in temp_search_nav_sort) {
					if (i != index) {
						if (temp_search_nav_sort[i]['icon'] != null) {
							temp_search_nav_sort[i]['icon'] = 'default';
						}
						temp_search_nav_sort[i]['sort'] = 'desc';
					}
				}
				temp_search_nav_sort[index]['sort'] = temp_sort;
				if (temp_search_nav_sort[index]['icon'] != null) {
					temp_search_nav_sort[index]['icon'] = temp_sort;
				}
				this.search_nav_sort_index = index;
				this.search_nav_sort_list = temp_search_nav_sort;
				this.data_page = 1;
				this.getgoodsRing(1);
			},
			// 条件-更多数据展示事件
			more_event(e) {
				var value = e.currentTarget.dataset.value || null;
				var temp_more = this.map_fields_list;
				if (value != null && (temp_more[value] || null) != null) {
					temp_more[value]['height'] = temp_more[value]['height'] == 'auto' ? temp_more[value]['default'] :
						'auto';
					this.map_fields_list = temp_more
				}
			},
			// 条件-清空
			map_remove_event(e) {
				var temp_list = this.search_map_list;
				var temp_post = this.post_data;

				// 关键字
				temp_post['wd'] = '';

				// 品牌、分类、价格、属性、规格
				for (var i in temp_list) {
					if ((temp_list[i] || null) != null && temp_list[i].length > 0) {
						for (var k in temp_list[i]) {
							temp_list[i][k]['active'] = 0;
						}
					}
				}

				// 排序导航
				var temp_search_nav_sort = this.search_nav_sort_list;
				for (var i in temp_search_nav_sort) {
					temp_search_nav_sort[i]['sort'] = 'asc';
					temp_search_nav_sort[i]['icon'] = (temp_search_nav_sort[i]['field'] == 'default') ? null : 'default';
				}

				// 关闭弹窗、分页恢复1页、重新获取数据
				this.search_map_list = temp_list
				this.post_data = temp_post
				this.is_show_popup_form = false
				this.search_nav_sort_list = temp_search_nav_sort
				this.search_nav_sort_index = 0
				this.data_page = 1;
				this.state = false;
				this.list_state = true;
				this.getgoodsRing(1);
			},
			// 条件-选择事件
			map_item_event(e) {
				var index = e.currentTarget.dataset.index;
				var field = e.currentTarget.dataset.field;
				var temp_list = this.search_map_list;
				if ((temp_list[field] || null) != null && (temp_list[field][index] || null) != null) {
					temp_list[field][index]['active'] = (temp_list[field][index]['active'] || 0) == 0 ? 1 : 0;
					// this.search_map_list = temp_list;
					this.$set(this.search_map_list, field, [...temp_list[field]]);
				}
			},
			// 品类选中事件
			category_envent(e) {
				var index = e.currentTarget.dataset.index;
				var id = e.currentTarget.dataset.id;
				this.category_screening_index = index;
				if (index === -1) {
					this.category_screening_index = -1;
					// this.category_id = '';
					this.cate_id = '';
				} else {
					this.category_screening_index = index;
					// this.category_id = id;
					this.cate_id = id;
				}

				this.data_bottom_line_status = false;
				this.data_page = 1;
				this.state = false;
				this.list_state = true;
				this.getgoodsRing();
			},
			OnEntryTime() {
				var radarlog_data = {
					pageUrl: "pages/goods_ring/goods_ring",
					name: "商品搜索页",
					remark: "商品搜索页停留时间",
					entryTime: this.entryTime,
				}
				uni.request({
					url: app.globalData.get_request_url("radarlog/add"),
					data: radarlog_data,
					method: "POST",
					success: (res) => {
						// console.log(res, "商品搜索页停留时间");
					}
				})
			}
		},
		// 分享给朋友
		onShareAppMessage(res) {
			return {
				title: app.globalData.data.tenantName,
				path: "pages/goods_ring/goods_ring?category_id=" + this.params.category_id + '&numberId=' + app.globalData
					.data.numberId,
				mpId: app.globalData.data.appid
			}
		},
		// 分享朋友圈
		// onShareTimeline(res) {
		// 	return {
		// 		title: app.globalData.data.tenantName,
		// 		type: 0,
		// 		summary: ""
		// 	}
		// },
		components: {
			componentPopup,
			componentSearch,
			componentBottomLine
		},
		onLoad(params) {
			if (typeof(params) != 'undefined') {
				var numberId = params.numberId || '';
				if (numberId != '') {
					uni.clearStorageSync();
					app.globalData.data.numberId = numberId;
				}
			}
			this.params = params;
			this.brandType = params.type;
			this.post_data.wd = this.params.keywords || '';
		},
		onShow() {
			this.init();
			// 记录用户进来时间
			this.entryTime = Date.now();
		},
		onUnload() {
			this.OnEntryTime();
		}
	}
</script>

<style>
	@import url("goods_ring.css");
</style>